package cn.ucai.day0906;

import java.util.Scanner;

public class TestArray4 {

	public static void main(String[] args) {
		int num=3;
		String nameArr[]=new String[num];
		int gradeArr[]=new int[num];
		int i=0;
		Scanner scan=new Scanner(System.in);
		while(i<num){
			System.out.println("请输入姓名:");
			nameArr[i]=scan.next();
			System.out.println("请输入分数:");
			gradeArr[i]=scan.nextInt();			
			i++;
		}
		System.out.println("请输入要查找的姓名：");
		String name=scan.next();
		for(i=0;i<num;i++){
			if(nameArr[i].equals(name)){
				System.out.println(name+"的分数是"+gradeArr[i]);
			}
			//break;
		}
		
		int sum=0;
		for(i=0;i<num;i++){
			sum+=gradeArr[i];							
			}
		System.out.println("全班平均分数是"+sum/num);
		
		int max=gradeArr[0];
		for(i=0;i<num;i++){
			if(gradeArr[i]>max)max=gradeArr[i];							
			}
		System.out.println("全班最高分数是"+max);
		
		}
	}
